# +----------------------------------------------------------------------
# | ChatWork智能聊天办公系统
# +----------------------------------------------------------------------
# | 软件声明: 本系统并非自由软件,未经授权任何形式的商业使用均属非法。
# | 版权保护: 任何企业和个人不允许对程序代码以任何形式任何目的复制/分发。
# | 授权要求: 如有商业使用需求,请务必先与版权所有者取得联系并获得正式授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from typing import List
from fastapi import APIRouter, Query
from hypertext import R, response_json
from apps.api.schemas.apply.draws import prompt_schema as schema
from apps.api.service.apply.draws.prompt_service import DrawsPromptService

router = APIRouter(prefix="/prompt", tags=["绘画词库接口"])


@router.get("/category", summary="分类列表", response_model=R[List[schema.DrawsPromptCategoryVo]])
@response_json
async def category(engine: str = Query(..., pattern=r"^(mj|sd|doubao|dalle)$")):
    return await DrawsPromptService.category(engine)


@router.get("/lexicon", summary="词汇列表", response_model=R[List[schema.DrawsPromptLexiconVo]])
@response_json
async def lexicon(
        engine: str = Query(..., pattern=r"^(mj|sd|doubao|dalle)$"),
        cid: int = Query(..., gt=0)
):
    return await DrawsPromptService.lexicon(engine, cid)


@router.get("/example", summary="示例列表", response_model=R[List[schema.DrawsPromptExampleVo]])
@response_json
async def example(engine: str = Query(..., pattern=r"^(mj|sd|doubao|dalle)$")):
    return await DrawsPromptService.example(engine)
